﻿#pragma once
#include<SapClassBasic.h>
#include <opencv2/opencv.hpp>
#include<QString>
using namespace cv;
using namespace std;

typedef void(__stdcall *CameraCallback)(cv::Mat image,void* UserContext);

class CameraDalsa
{

private:
    CameraCallback m_CallBack;
    void *m_Context;
public:
    ///<变量

    SapAcqDevice	*m_pAcqDevice = nullptr;
    SapBuffer		*m_pBuffers   = nullptr;
    SapTransfer		*m_pTransfer  = nullptr;
    void			*pData        = nullptr;


    int m_iImageHeight,m_iImageWidth;
    int m_iCamID;
public:
    void registerCallBack(CameraCallback pFunction, void *UserContext);

    bool	StartCapture( );
    bool	StopCapture( );
    bool	unInitCamera( );
    bool    SetExp(double exp);
    bool    SetGain(double gain);
    static void callback(SapXferCallbackInfo *pInfo);
    bool	CreateObjects();
    bool	DestroyObjects();

    bool initCamera(const char* name,CameraCallback pfunction, void* pcontext);

    bool softTrigger();

};


